﻿CREATE TABLE nodes 
(
	id INTEGER NOT NULL PRIMARY KEY,
	lon REAL NOT NULL,
	lat REAL NOT NULL
);

CREATE TABLE node_tags 
(
	ref INTEGER NOT NULL,
	key TEXT,
	value TEXT
);


CREATE TABLE way_nodes 
(
	way INTEGER NOT NULL,
	num INTEGER NOT NULL,
	node INTEGER NOT NULL
);


CREATE TABLE way_tags 
(
	ref INTEGER NOT NULL,
	key TEXT,
	value TEXT
);


CREATE TABLE ways 
(
	id INTEGER NOT NULL PRIMARY KEY
);


CREATE TABLE ways_full 
( 
id_way INTEGER NOT NULL , 
id_node INTEGER NOT NULL , 
num INTEGER , 
name TEXT, 
node_lat REAL, 
node_lon REAL, 
type TEXT , 
subtype TEXT 
);

create index indexNodeIds on ways_full (id_node);
create index indexWayIds on ways_full (id_way);
create index indexNodeNums on ways_full (num);

create index indexNodeLat on ways_full (node_lat);
create index indexNodeLon on ways_full (node_lon);